define(["utils"],function(utils){

    function pageLogic(config){
      this.pageview = config.pageview;
      this.id = this.pageview.params.id;
      this.token = this.pageview.params.token;

      this.setHeader();
    }
    pageLogic.prototype = {
      onPageResume:function(){
        this.setHeader();
      },
      setHeader:function(){
        try{
          window.yyesn.client.setHeader(function(){},{
            type:2,
            title:"评论",
            rightTitle:"",
            rightValues:[],
          },function(b){

          });
        }catch(e){

        }
      },
        backIcon_click:function(sender,params){
          this.pageview.goBack();
        },
        comment_input_click:function(){
          this.pageview.showPage({
            pageKey:"comment",
            nocache:true,
            mode:"fromBottom"
          });
        },
        listview_init:function(sender){
          this.listview = sender;
        },
        listview_beforeload:function(sender,params){
          sender.setAjaxConfigParams({
            id:this.id ,
          token:this.token,
          timestamp:(new Date()).valueOf()});
        },
        listview_parsedata:function(sender,params){
          return params.data.data;
        },
        page_content_pulltorefresh:function(sender,params){
          this.listview.loadFirstPageData();
        },
        page_content_loadmore:function(sender,params){
          this.listview.loadNextPageData();
        },
        row_time_init:function(sender,params){
          sender.config.text  =utils.timestampToTimeStr(sender.datasource.createTime);
        }
    };
    return pageLogic;
});
